package com.example.android09_preference0219;

import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

public class MainActivity extends Activity {

	private TextView interCall;
	private TextView rTone;
	private TextView sleepMode;
	private ImageButton settings;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		interCall=(TextView) findViewById(R.id.interCall);
		rTone=(TextView) findViewById(R.id.rtone);
		sleepMode=(TextView) findViewById(R.id.sleepMode);
		settings=(ImageButton) findViewById(R.id.settings);
		
		settings.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this,EditActivity.class);
				startActivity(intent);
			}
		});
	}
@Override
protected void onResume() {
	// TODO Auto-generated method stub
	
	
	super.onResume();
	SharedPreferences sharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
	interCall.setText(new Boolean(sharedPreferences.getBoolean("interCall", false)).toString());
	rTone.setText(sharedPreferences.getString("ringtone", "not"));
	//sleepMode.setText(new Boolean(sharedPreferences.getBoolean("sleepMode", false)).toString());
}



}
